//
//  AXFMineOrderViewController.m
//  BEEQUICK
//
//  Created by mac2 on 16/11/19.
//  Copyright © 2016年 SevenGroup. All rights reserved.
//

#import "AXFMineOrderViewController.h"
#import "AXFMineOrderBtnView.h"
#import "EmptyOrder.h"
#import "AXFMineController.h"
#import "AXFWhiteNavView.h"
#import "AXFOrderTableViewCell.h"
//#import "AXFFirstCell.h"
@interface AXFMineOrderViewController ()<AXFWhiteNavViewDelegate,UITableViewDataSource>

@property(strong,nonatomic)NSMutableArray *orderArray;
@property(nonatomic,weak)UITableView *tableView;
@end

@implementation AXFMineOrderViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tableView.rowHeight = 205;
//    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    
    [self.tableView registerClass:[AXFOrderTableViewCell class] forCellReuseIdentifier:@"ordercell"];
    
}
//添加navigationController
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
//    self.navigationController.navigationBar.hidden = NO;

}

//空的界面


#pragma mark - 1.0界面搭建

-(void)setupUI{
	
    //1.导航条标题
    AXFWhiteNavView *whiteNavView = [[AXFWhiteNavView alloc] init];
    
    [whiteNavView setTitleName:@"我的订单" andFunctionName:nil];
    
    whiteNavView.delegate = self;
    
    [self.view addSubview:whiteNavView];
    
    [whiteNavView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.offset(0);
        make.height.mas_equalTo(kNAVBARH + 20);
    }];

    //btnView上有一根线
    UIView *line = [[UIView alloc]init];
    [self.view addSubview:line];
    line.backgroundColor = [UIColor grayColor];
    
    //2.创建fourBtnView
    AXFMineOrderBtnView *btnView = [[AXFMineOrderBtnView alloc]init];
    
    [btnView btnViewWithButtonTag:self.mineOrderButtonTag];
    
    
    //3.添加子控制器
    UITableViewController *orderChildVC = [[UITableViewController alloc]init];
    [self addChildViewController:orderChildVC];
    [orderChildVC didMoveToParentViewController:self];
    self.tableView = orderChildVC.tableView;
    [orderChildVC.tableView registerClass:[AXFOrderTableViewCell class] forCellReuseIdentifier:@"ordercell"];
    
    
    //4.子控制器的布局
    orderChildVC.view.backgroundColor = [UIColor cz_colorWithHex:0xefefef];
    orderChildVC.tableView.frame = CGRectMake(0, 64+42, self.view.frame.size.width, self.view.frame.size.height);
    [self.view addSubview:orderChildVC.view];
    self.tableView = orderChildVC.tableView;
    
    //约束
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.tableView);
        make.top.equalTo(self.view).offset(64);
        make.height.equalTo(@1);
    }];
    [self.view addSubview:btnView];
    [btnView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(line.mas_bottom);
        make.left.right.equalTo(self.view);
        make.height.equalTo(@44);
    }];
    
    
    //刷新界面
    
}
//tableVIew代理数据yuan方法
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    AXFOrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ordercell" forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellAccessoryNone;
    return cell;
}

- (void)backToViewController
{
	[self.navigationController popViewControllerAnimated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
